import {reactive, ref} from 'vue'
import axios from "axios";

export const useRequest = (url = '') => {

    const loading = ref(true);
    const data = ref(null)
    let message = ref('')

    axios.get(url).then((response: any) => {
        data.value = response.data

    }).catch((err: any) => {
        message = err.message
    }).finally(() => loading.value = false)

    return {
        loading,
        data,
        message
    }
}